home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / GNU-TILE-FORTH.lha / src / memory.v < prev    next >
Text File  |  1992-05-19  |  2KB  |  67 lines

  1. /*
  2.   C BASED FORTH-83 MULTI-TASKING KERNEL: MEMORY ALLOCATION
  3.  
  4.   Copyright (C) 1988-1990 by Mikael R.K. Patel
  5.  
  6.   Computer Aided Design Laboratory (CADLAB)
  7.   Department of Computer and Information Science
  8.   Linkoping University
  9.   S-581 83 LINKOPING
  10.   SWEDEN
  11.  
  12.   Email: mip@ida.liu.se
  13.  
  14.   Started on: 30 June 1988
  15.  
  16.   Last updated on: 20 April 1990
  17.  
  18.   Dependencies:
  19.     (cc) kernel.c, kernel.h
  20.  
  21.   Description:
  22.     Memory allocation extension vocabulary for the multi-tasking
  23.     tile forth kernel.
  24.  
  25.   Copying:
  26.        This program is free software; you can redistribute it and/or modify
  27.        it under the terms of the GNU General Public License as published by
  28.        the Free Software Foundation; either version 1, or (at your option)
  29.        any later version.
  30.  
  31.        This program is distributed in the hope that it will be useful,
  32.        but WITHOUT ANY WARRANTY; without even the implied warranty of
  33.        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  34.        GNU General Public License for more details.
  35.  
  36.        You should have received a copy of the GNU General Public License
  37.        along with this program; see the file COPYING.  If not, write to
  38.        the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  39.  
  40. */
  41.  
  42. VOID domalloc()
  43. {
  44.     tos.PTR8 = (PTR8) malloc((unsigned) tos.NUM32);
  45. }
  46.  
  47. NORMAL_CODE(malloc_entry, forth, "malloc", domalloc);
  48.  
  49. VOID dorealloc()
  50. {
  51.     PTR8 m = spop(PTR8);
  52.     
  53.     tos.PTR8 = (PTR8) realloc((char *) m, (unsigned) tos.NUM32);
  54. }
  55.  
  56. NORMAL_CODE(realloc_entry, malloc_entry, "realloc", dorealloc);
  57.  
  58. VOID dofree()
  59. {
  60.     PTR8 m = spop(PTR8);
  61.     
  62.     free(m);
  63. }
  64.  
  65. NORMAL_CODE(free_entry, realloc_entry, "free", dofree);
  66.  
  67.